import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/home/index'
},
{
  path: '/home',
  name: 'Home',
  component: () => import(/* webpackChunkName: "home" */ '@/views/home'),
  children: [{
    path: '/home/index',
    name: 'Index',
    component: () => import(/* webpackChunkName: "index" */'@/views/home/index/index.vue')
  }, {
    path: '/home/menu',
    name: 'menu',
    component: () => import(/* webpackChunkName: "menu" */'@/views/home/menu/index.vue')
  }]
},
{
  path: '/detail/:id',
  name: 'Detail',
  component: () => import(/* webpackChunkName: "detail" */ '@/views/detail')
},
{
  path: '/login',
  name: 'Login',
  component: () => import(/* webpackChunkName: "login" */ '@/views/login')
}
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
